package com.zy.restApi;

import com.zy.web.bean.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @program: shopping153_cloud
 * @description: 访问IdGenerator服务的Api接口, 由openFeign生成代理对象
 * @author: zy
 * @create: 2025-08-22 16:36
 */

@FeignClient(name="idGenerator")
public interface IdGeneratorApi {

    @GetMapping("/id/next")
    public ResponseResult<Long> getNextId();

    @GetMapping("/batch")
    public ResponseResult getBatchIds(@RequestParam(value="size", defaultValue = "10") int size) ;

    /**
     * 解析时间戳
     */
    @GetMapping("/parse/time")
    public ResponseResult parseTime(@RequestParam("id") long id) ;

    /**
     * 解析 datacenterId
     */
    @GetMapping("/parse/datacenter")
    public ResponseResult parseDatacenter(@RequestParam("id") long id) ;

    /**
     * 解析 workerId
     */
    @GetMapping("/parse/worker")
    public ResponseResult parseWorker(@RequestParam("id") long id) ;

}
